<!--js:侧边栏菜单-->
<div class="aside" id="aside">
  <ul class="nav nav-menu">
    <!--后台管理-->
    {%notempty name="menuMain"%}
      {%foreach name="menuMain" item="vo"%}
        {%notempty name="menuShow[$vo['class_id']]"%}
        <li>
        <a class="dropdown-toggle" href="#" data-cmd="slideNav"><i class="icon i-off"></i>{%$vo.name%}</a>
            <!--判断有没有子目录-->
            {%notempty name="menuSub[$vo['class_str']]"%}
                {%foreach name="menuSub[$vo['class_str']]" item="vos"%}
                    {%notempty name="menuShow[$vos['class_id']]"%}
                      <ul class="dropdown-menu">
                        <li>
                          <a class="dropdown-toggle" href="#" data-cmd="slideNav"><i class="icon i-arrow-right"></i>{%$vos.name%}</a>
                          <ul class="dropdown-submenu">
                            {%notempty name="myAtomList[$vos['class_id']]"%}
                                {%foreach name="myAtomList[$vos['class_id']]" item="voss"%}
                                {%if condition="$voss['hidden_type'] eq 1"%}
                                    <li><a onclick="ST.todo('navClick', this); return false;" href='{%$voss.func_name%}?{%$voss.func_data%}'>{%$voss.name%}</a></li>
                                {%/if%}
                                {%/foreach%}
                            {%/notempty%}
                          </ul>
                        </li>
                      </ul>
                    {%/notempty%}
                {%/foreach%}
            {%/notempty%}
        </li>
        {%/notempty%}
      {%/foreach%}
    {%/notempty%}
  </ul>
</div>

<script type="text/javascript">
    $.extend(ST, {
        navConfig: {
            onlyOneNav: true//配置是否一次只允许展开一个
        },
        navClick: function(obj) {
            $('.dropdown-submenu li').attr('class', '');
            $(obj).parent().addClass('active current');
            $('#rightMain').attr('src', $(obj).attr('href'));
        },
        slideNav: function (em, no_ani) {
            var $this = $(em), p = $this.parent(), c = ST.navConfig;
            if (no_ani) {
                $this.siblings().toggle();
            } else {
                $this.siblings().stop(true, true).slideToggle();
            }
            p.toggleClass('menu-on', !p.hasClass('menu-on'));
            if (c.onlyOneNav) {
                p.siblings()
                 .toggleClass('menu-on', false)
                 .children('ul').each(function () {
                     if ($(this).css('display') != 'none') {
                         if (no_ani) {
                             $(this).toggle();
                         } else {
                             $(this).slideToggle();
                         }
                     }
                 });
            }
        },
        initSideNav: function () {
            var $wrap = $("#aside");
            $wrap.evProx({
                'click': {
                    'a': function (e) {
                        var $this = $(this), cmd = $this.data('cmd');
                        if (cmd) {
                            var pars = $this.data('pars'), oPars = '';
                            if (pars) {
                                oPars = {};
                                pars = pars.split(',');
                                for (var i = 0, l = pars.length, d; i < l, d = pars[i]; i++) {
                                    d = d.split(':');
                                    oPars[d[0]] = d[1];
                                }
                            }
                            if (ST[cmd] && $.Lang.isMethod(ST[cmd])) {
                                ST.todo(cmd, this, oPars);
                            }
                            return false;
                        }
                    }
                }
            });
            //自动展开选中项
            var $cnode = $wrap.find('li.current:first'), $a;
            if ($cnode.length > 0) {
                $a = $cnode.parents('ul').prevAll('a[data-cmd="slideNav"]');
            } else {
                $a = $wrap.find('a[data-cmd="slideNav"]');
            }
            $a.each(function () {
                ST.slideNav(this, true);
            });
            var activeLi = $wrap.find('.active,.current');
            if (activeLi.length == 0) {
                $('ul.dropdown-menu li ul').hide();
                $('ul.dropdown-menu li').removeClass('menu-on');
            }
        }
    });
    ST.TODOLIST.push({method: "initSideNav", pars: {}});
</script>
<!--aside-->